using System;
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Ccr.Core;
using Microsoft.Dss.Core.Attributes;
using Microsoft.Dss.ServiceModel.Dssp;
using Microsoft.Dss.ServiceModel.DsspServiceBase;
using W3C.Soap;

namespace HCC.Robotics.Services.HCCGenericVisionModule
{
    public sealed class Contract
    {
        [DataMember]
        public const string Identifier = "http://www.hccrobotica.nl/2011/09/hccgenericvisionmodule.html";
    }

    [DataContract]
    public class HCCGenericVisionModuleState
    {
    }

    [ServicePort]
    public class HCCGenericVisionModuleOperations : PortSet<DsspDefaultLookup, DsspDefaultDrop, Get, Subscribe, VisionDataUpdate>
    {
    }

    public class Get : Get<GetRequestType, PortSet<HCCGenericVisionModuleState, Fault>>
    {
        public Get()
        {
        }

        public Get(GetRequestType body)
            : base(body)
        {
        }

        public Get(GetRequestType body, PortSet<HCCGenericVisionModuleState, Fault> responsePort)
            : base(body, responsePort)
        {
        }
    }

    public class Subscribe : Subscribe<SubscribeRequestType, PortSet<SubscribeResponseType, Fault>>
    {
        public Subscribe()
        {
        }

        public Subscribe(SubscribeRequestType body)
            : base(body)
        {
        }

        public Subscribe(SubscribeRequestType body, PortSet<SubscribeResponseType, Fault> responsePort)
            : base(body, responsePort)
        {
        }
    }

    [DataContract]
    public class VisionData
    {
        [DataMember]
        public DateTime TimeStamp { get; set; }

        // Field Data
        [DataMember]
        public int TopLeftX { get; set; }
        [DataMember]
        public int TopRightX { get; set; }
        [DataMember]
        public int BottomLeftX { get; set; }
        [DataMember]
        public int BottomRightX { get; set; }
        [DataMember]
        public int LeftGoalUpperX { get; set; }
        [DataMember]
        public int LeftGoalLowerX { get; set; }
        [DataMember]
        public int RightGoalUpperX { get; set; }
        [DataMember]
        public int RightGoalLowerX { get; set; }
        [DataMember]
        public int TopLeftY { get; set; }
        [DataMember]
        public int TopRightY { get; set; }
        [DataMember]
        public int BottomLeftY { get; set; }
        [DataMember]
        public int BottomRightY { get; set; }
        [DataMember]
        public int LeftGoalUpperY { get; set; }
        [DataMember]
        public int LeftGoalLowerY { get; set; }
        [DataMember]
        public int RightGoalUpperY { get; set; }
        [DataMember]
        public int RightGoalLowerY { get; set; }

        // Ball Data
        [DataMember]
        public int BallX { get; set; }
        [DataMember]
        public int BallY { get; set; }

        // Player Data
        [DataMember]
        public int BluePlayer1X { get; set; }
        [DataMember]
        public int BluePlayer1Y { get; set; }
        [DataMember]
        public int BluePlayer1H { get; set; }

        [DataMember]
        public int BluePlayer2X { get; set; }
        [DataMember]
        public int BluePlayer2Y { get; set; }
        [DataMember]
        public int BluePlayer2H { get; set; }

        [DataMember]
        public int YellowPlayer1X { get; set; }
        [DataMember]
        public int YellowPlayer1Y { get; set; }
        [DataMember]
        public int YellowPlayer1H { get; set; }

        [DataMember]
        public int YellowPlayer2X { get; set; }
        [DataMember]
        public int YellowPlayer2Y { get; set; }
        [DataMember]
        public int YellowPlayer2H { get; set; }

        [DataMember]
        public bool Valid { get; set; }
    }

    public class VisionDataUpdate : Update<VisionDataUpdateRequest, PortSet<DefaultUpdateResponseType, Fault>>
    {
        public VisionDataUpdate()
        {
        }
        public VisionDataUpdate(VisionData data)
            : base(new VisionDataUpdateRequest(data))
        {
        }
    }

    [DataContract]
    public class VisionDataUpdateRequest
    {
        public VisionDataUpdateRequest()
        {
        }
        public VisionDataUpdateRequest(VisionData data)
        {
            Data = data;
        }
        [DataMember]
        public VisionData Data { get; set; }
    }
}
